package executable.instance;

import ctu.kfad.run.memory.FieldValueConverter;
import ctu.kfad.run.memory.MemoryManager;

public class ClassWithAllFieldTypeSize {

    private int value1;
    private int value2;
    private int value3;
    private int value4;
    private int value5;
    private int value6;
    private int value7;
    private String valueS2;
    private ClassWithAllFieldTypeSize valueR3;

    private static void fillMemory() {
        final int count = MemoryManager.MEMORY_SIZE / (FieldValueConverter.INT_BYTE_SIZE + 2 * FieldValueConverter.REFERENCE_BYTE_SIZE);
        ClassWithAllFieldTypeSize[] array = new ClassWithAllFieldTypeSize[count];
        for (int i = 0; i < count; i++) {
            array[i] = new ClassWithAllFieldTypeSize();
        }
    }

    private static void fillMemoryInMoreMethods() {
        for (int i = 0; i < 1000; i++) {
            createALotObjects();
        }
    }

    private static void createALotObjects() {
        final int count = 10;
        ClassWithAllFieldTypeSize[] array = new ClassWithAllFieldTypeSize[count];
        for (int i = 0; i < count; i++) {
            final ClassWithAllFieldTypeSize classWithAllFieldTypeSize = new ClassWithAllFieldTypeSize();
            classWithAllFieldTypeSize.valueS2 = "a";
            array[i] = classWithAllFieldTypeSize;
            if (i > 5) {
                classWithAllFieldTypeSize.valueR3 = array[i - 1];
            }
        }
    }


}
